package com.shop.shoporder.wapController;

import com.shop.shoporder.common.MessageConstants;
import com.shop.shoporder.common.Response;
import com.shop.shoporder.common.UserLoginToken;
import com.shop.shoporder.service.OrderReturnsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@Controller
@CrossOrigin(origins = "*",maxAge = 3600)
@RequestMapping("/wap")
public class OrderReturnController {
    @Autowired
    OrderReturnsService orderReturnsService;

    @UserLoginToken
    @ResponseBody
    @RequestMapping(value = "/applyReturn",method = RequestMethod.POST)
    //
    public Response applyReturn(@RequestParam Map<String,String> map, HttpServletRequest request) {
        Response response=new Response();
        try{
            response=orderReturnsService.applyReturn(map,request);
        }catch (Exception e){
            e.printStackTrace();
            return new Response(MessageConstants.MSG_SYS_ERROR,null,0,"获取异常！",request);
        }
        return response;
    }
}
